/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package tEDF_LL73.impl;

import genArchi.impl.NodeImpl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import pUNB.PUNB;
import result.Results;

import tEDF_LL73.TEDF_LL73;
import tEDF_LL73.TEDF_LL73Package;
import utils.UtilsModelInstance;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>TEDF LL73</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link tEDF_LL73.impl.TEDF_LL73Impl#getPU <em>PU</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TEDF_LL73Impl extends NodeImpl implements TEDF_LL73 {
	/**
	 * The cached value of the '{@link #getPU() <em>PU</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPU()
	 * @generated
	 * @ordered
	 */
	protected PUNB pU;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TEDF_LL73Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return TEDF_LL73Package.Literals.TEDF_LL73;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PUNB getPU() {
		if (pU != null && pU.eIsProxy()) {
			InternalEObject oldPU = (InternalEObject)pU;
			pU = (PUNB)eResolveProxy(oldPU);
			if (pU != oldPU) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, TEDF_LL73Package.TEDF_LL73__PU, oldPU, pU));
			}
		}
		return pU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PUNB basicGetPU() {
		return pU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPU(PUNB newPU) {
		PUNB oldPU = pU;
		pU = newPU;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TEDF_LL73Package.TEDF_LL73__PU, oldPU, pU));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case TEDF_LL73Package.TEDF_LL73__PU:
				if (resolve) return getPU();
				return basicGetPU();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case TEDF_LL73Package.TEDF_LL73__PU:
				setPU((PUNB)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case TEDF_LL73Package.TEDF_LL73__PU:
				setPU((PUNB)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case TEDF_LL73Package.TEDF_LL73__PU:
				return pU != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public void compute() {

		/**/
		this.todo = true;
		
		/* ComputeBox processor utilization created */
		if (this.pU != null) {
			
			/* Set of tasks is schedulable */
			if (this.pU.getU() <= 1) {
				
				UtilsModelInstance.createSchedulingResult(this, Results.SCHEDULABLE);
			}

			/* Set of tasks is not schedulable */
			else {
				UtilsModelInstance.createSchedulingResult(this, Results.NON_SCHEDULABLE);
			}

			this.todo = false;
		}



	} //compute()
} //TEDF_LL73Impl
